{layout name="layout/header" /}
<link href="root/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="root/css/plugins/summernote/summernote.css" rel="stylesheet">
<link href="root/css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
<link href="root/js/plugins/fancybox/jquery.fancybox.css" rel="stylesheet">

<div class="wrapper wrapper-content animated fadeInRight">

    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>{$title}</h5>
                    <div class="ibox-tools">
                        <button type="button" class="btn btn-primary btn-sm refresh">刷新</button>

                    </div>
                </div>
                <div class="ibox-content">
                    <form method="post" class="form-horizontal" id="form" action="{$action}">
                        {volist name="data" id="vo"}
                            {switch name="$vo.type"}
                                {case value="text"}
                                    <div class="form-group">
                                        <label class="col-sm-1 control-label">{$vo.title}</label>
                                        <div class="col-sm-11">
                                            <input type="text" placeholder="{$vo.title}" value="{$vo.value}" class="form-control" name="data[{$vo.name}]" >
                                            <span class="help-block m-b-none">{$vo.remark}</span>
                                        </div>
                                    </div>
                                {/case}
                                {case value="textarea"}
                                    <div class="form-group">
                                        <label class="col-sm-1 control-label">{$vo.title}</label>
                                        <div class="col-sm-11">
                                            <textarea class="form-control" name="data[{$vo.name}]">{$vo.value}</textarea>
                                            <span class="help-block m-b-none">{$vo.remark}</span>
                                        </div>
                                    </div>
                                {/case}
                                {case value="radio"}
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">{$vo.title}</label>
                                    <div class="col-sm-11">
                                        <div class="radio i-checks">
                                            {volist name="$vo.option" id="vc"}
                                            <label><input type="radio" value="{$vc[0]}" name="data[{$vo.name}]" {eq name="$vc[0]" value="$vo.value"}checked{/eq}> <i></i>{$vc[1]}</label>
                                            {/volist}
                                        </div>
                                        <span class="help-block m-b-none">{$vo.remark}</span>
                                    </div>
                                </div>
                                {/case}
                                {case value="select"}
                                    <div class="form-group">
                                        <label class="col-sm-1 control-label">{$vo.title}</label>
                                        <div class="col-sm-11">
                                            <select class="form-control m-b" name="data[{$vo.name}]">
                                                {volist name="$vo.option" id="vc"}
                                                <option value="{$vc[0]}" {eq name="$vo.value" value="$vc[0]"}selected{/eq}>{$vc[1]}</option>
                                                {/volist}
                                            </select>
                                            <span class="help-block m-b-none">{$vo.remark}</span>
                                        </div>
                                    </div>
                                {/case}
                            {/switch}
                        {/volist}

                        <!--图片上传-->


                        <!--<div class="form-group">-->
                            <!--<label class="col-sm-1 control-label">注册协议</label>-->
                            <!--<div class="col-sm-10">-->
                                <!--<textarea name="notice" id="notice" style="display: none;">-->
                                    <!---->
                                <!--</textarea>-->
                                <!--<div class="ibox-content no-padding" >-->
                                    <!--<div class="summernote" >-->
                                      <!---->
                                    <!--</div>-->
                                <!--</div>-->
                            <!--</div>-->
                        <!--</div>-->
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="submit">保存</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

</div>

<!-- iCheck -->
<script src="root/js/plugins/iCheck/icheck.min.js"></script>
<!--layer-->
<script src="root/js/plugins/layer/layer.min.js"></script>

<script src="root/js/plugins/validate/jquery.validate.min.js"></script>
<script src="root/js/plugins/validate/messages_zh.min.js"></script>
<script src="root/js/plugins/fancybox/jquery.fancybox.js"></script>
<script src="root/js/plugins/summernote/summernote.min.js"></script>
<script src="root/js/plugins/summernote/summernote-zh-CN.js"></script>
<script>
    $(document).ready(function () {
        checks();
        $('.fancybox').fancybox({
            openEffect: 'none',
            closeEffect: 'none'
        });

    });

</script>
<script>
    $(function () {
        $("#form").validate({
            rules: {
                web_site_title: {
                    required:true
                },
            }
        })
    })
</script>
<script type="text/javascript">
    //summernote编辑器图片上传

        $('.summernote').summernote({
            lang:'zh-CN',
            // 重写图片上传
            onImageUpload: function(files, editor, $editable) {
                sendFile(files[0],editor,$editable);
            },
            onblur:function () {
                var content = $(this).code();
                $(this).parent().parent().prev().val(content);
            }
        });



</script>